//
//  MachineHandler.h
//  recordTest
//
//  Created by Jason on 2017/5/31.
//  Copyright © 2017年 LiuYu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Speech/Speech.h>
#import <AVFoundation/AVFoundation.h>

@interface MachineHandler : NSObject

@end


/****************************语音控制*******************************/
@interface  SpeechHandler: NSObject<SFSpeechRecognizerDelegate>

typedef NS_ENUM(NSInteger, SPEECH_AUTH){
    LY_SpeechRecognizerAuthorizationStatusNotDetermined = 0,
    LY_SpeechRecognizerAuthorizationStatusDenied,
    LY_SpeechRecognizerAuthorizationStatusRestricted,
    LY_SpeechRecognizerAuthorizationStatusAuthorized,
};

typedef NS_ENUM(NSInteger, SPEECH_COUNTY){
    LY_CHINA = 0,
    LY_USA,
};

typedef void(^LY_SPEECH_BlOCK)(NSString *SrcString);

typedef void(^LY_SPEECH)(BOOL suc);

@property (nonatomic, strong) SFSpeechRecognizer *speechRecognizer;
@property (nonatomic, strong) AVAudioEngine *audioEngine;
@property (nonatomic, strong) SFSpeechRecognitionTask *recognitionTask;
@property (nonatomic, strong) SFSpeechAudioBufferRecognitionRequest *recognitionRequest;
@property (nonatomic, assign) SPEECH_COUNTY speechType;
@property (nonatomic, copy) LY_SPEECH_BlOCK block;

@property (nonatomic, copy) LY_SPEECH stop_block;

/**设置识别语言,需要重新调用startRecording*/
- (void)setSpeechType:(SPEECH_COUNTY)type;

/**开始识别*/
- (void)start;

/**停止识别*/
- (void)stop:(LY_SPEECH)suc;
@end
/***********************************************************/



@interface CoreMotionHandler : NSObject

@end


/****************************照明*******************************/
@interface TorchHandler : NSObject

@property (nonatomic, assign)BOOL isOpen;

- (void)turnTorchOn:(bool) on;
@end
/***********************************************************/
